<!DOCTYPE html>
<html>
<head>
	<title>	</title>
</head>
<body>
	<div id="app">
		<p>时间: {{date}}</p>
		<p>
			完整版{{date | dataString}}
		</p>
		<p>
			年月日{{date | dataString('YYYY-MM-DD')}}
		</p>
		<p>
			时分秒{{date | dataString('HH:mm:ss')}}
		</p>
	</div>
	<script type="text/javascript" src="../js/vue.js"></script>
	<script type="text/javascript" src="https://cdn.bootcdn.net/ajax/libs/moment.js/2.29.1/moment.min.js"></script>
	<script type="text/javascript">
		// 自定义过滤器
		Vue.filter('dataString', function(value, format) {
			var formatStr = format != undefined? format: 'YYYY-MM-DD HH:mm:ss';
			return moment(value).format(formatStr);
		});

		var vm = new Vue({
			el: '#app',
			data: {
				date: new Date()
			}
		});

	</script>
</body>
</html>